/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Random;
import java.util.Scanner;

/**
 * <p>Project: app2022 - Arr5
 * <p>Powered by webrx On 2022-01-08 17:56:59
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Arr5 {
    public static void main(String[] args) {
        System.out.println("请输入0-100直接的数");
        Random r = new Random();
        int num = r.nextInt(100) + 1;
        //System.out.println(num);
        Scanner s = new Scanner(System.in);
        int count = 0;
        for (int i = 0; i < 11; i++) {
            ++count;
            //System.out.println(count);
            int temp = 0;
            if (s.hasNextInt()) {
                temp = s.nextInt();
            } else {
                String s1 = s.next();
                if ("quit".contains(s1)) {
                    s.close();
                    System.out.printf("程序退出，游戏结束！%n");
                    break;
                }
                System.out.printf("输入有误%s，请重新输入！%n", s1);
                continue;
            }


            if (temp > num) {
                System.out.println("大了");
            } else if (temp < num) {
                System.out.println("小了");
            } else {

                if (count == 1) {
                    System.out.printf("第一次就猜对了，您可真棒哦！");
                } else {
                    System.out.printf("一共猜了%d次,你的得分是：%d", count, 100 - count * 10);
                }
                break;
            }

            if (count == 11) {
                System.out.println("您一共猜了11次,还没猜对，您真的不适合这个游戏");

            }
        }

    }


    public static void main33(String[] args) {
        int[] a = {9, 69, 28, 54, 56, 35, 76, 26, 46, 9, 78, 98, 54, 45};
        for (int i = 0; i < a.length; i++) {
            int min = a[i];
            for (int k = 0; k < a.length; k++) {
                if (a[k] > min) {
                    int temp = min;
                    min = a[k];
                    // a[k] = min;
                    a[k] = temp;
                    //a[k] = temp;
                }
            }
            a[i] = min;
        }
        for (int j = 0; j < a.length; j++) {
            System.out.println(a[j]);
        }
    }

    public static void main2(String[] args) {
        int[] i;
        int[][] i2;
        byte[][][] bs;
        int[][][][] nu4;

        int[][] my = new int[3][4];

        int[][] mm = {{1, 2, 3}, {4, 5, 6, 7, 8, 9}, {11, 22, 33, 44, 55}};
        System.out.println(mm[2][2]);

        System.out.println(mm[1][5]);
    }
}
